Skip to content

DOC-6644 Semantic cache use case example#3354

Merged
andy-stark-redis merged 8 commits into
mainfrom
DOC-6644-sem-cache-use-case
May 28, 2026
Merged

DOC-6644 Semantic cache use case example#3354
andy-stark-redis merged 8 commits into
mainfrom
DOC-6644-sem-cache-use-case

Conversation

@andy-stark-redis

@andy-stark-redis andy-stark-redis commented May 21, 2026

Copy link
Copy Markdown
Contributor

Not finished yet - this is just for some early Bugbot reports at this stage.


Note

Medium Risk
Large new example surface (vector search, embeddings, multi-client parity) where subtle bugs in TAG escaping, thresholds, or concurrency could mislead readers; changes are docs/demos only, not production services.

Overview
Adds a new semantic cache use case under content/develop/use-cases/semantic-cache/: a landing page that explains thresholded KNN over cached LLM responses (with tenant/locale/model metadata in FT.SEARCH), links it from the use-cases index, and ships runnable multi-language examples—this diff includes full Go (go-redis + Hugot) and .NET (NRedisStack + ONNX Runtime) stacks with shared interactive index.html, mock LLM, seed data, and per-language guides.

The redis-use-case-ports skill and audit-checklist.md gain six new rows (29–34) and a Phase 4b note to verify independent-review findings before fixing, capturing bug classes found while building this use case (embedder thread-safety, fake config knobs, lockfile vs manifest PHP version, NaN parsing quirks, /state-driven UI strings, escaped TAG values in docs).

Reviewed by Cursor Bugbot for commit 8e68f82. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions

github-actions Bot commented May 21, 2026

Copy link
Copy Markdown
Contributor

DOC-6644

@jit-ci

jit-ci Bot commented May 21, 2026

Copy link
Copy Markdown

🛡️ Jit Security Scan Results

CRITICAL HIGH MEDIUM

✅ No security findings were detected in this PR


Security scan by Jit

Comment thread content/develop/use-cases/semantic-cache/redis-py/demo_server.py
@jit-ci

jit-ci Bot commented May 21, 2026

Copy link
Copy Markdown

❌ Jit Scanner failed - Our team is investigating

Jit Scanner failed - Our team has been notified and is working to resolve the issue. Please contact support if you have any questions.


💡 Need to bypass this check? Comment @sera bypass to override.

renderStats();
</script>
</body>
</html>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Identical HTML files duplicated across language demos

Low Severity

go/index.html and java-jedis/index.html are byte-for-byte identical 513-line files. Any fix (accessibility, styling, logic) must be replicated across every copy. The files already use runtime token substitution (__INDEX_NAME__, __KEY_PREFIX__) and a /state endpoint for per-language values, so a single shared file (symlinked or referenced from a common location) would work without code changes.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 07e86a0. Configure here.

@jit-ci

jit-ci Bot commented May 22, 2026

Copy link
Copy Markdown

❌ Jit Scanner failed - Our team is investigating

Jit Scanner failed - Our team has been notified and is working to resolve the issue. Please contact support if you have any questions.


💡 Need to bypass this check? Comment @sera bypass to override.

@andy-stark-redis andy-stark-redis requested a review from a team May 22, 2026 08:44
@andy-stark-redis andy-stark-redis self-assigned this May 22, 2026
@andy-stark-redis andy-stark-redis added clients Client library docs and removed do not merge yet labels May 22, 2026
@jit-ci

jit-ci Bot commented May 22, 2026

Copy link
Copy Markdown

❌ Jit Scanner failed - Our team is investigating

Jit Scanner failed - Our team has been notified and is working to resolve the issue. Please contact support if you have any questions.


💡 Need to bypass this check? Comment @sera bypass to override.

Comment thread content/develop/use-cases/semantic-cache/go/cache.go Outdated
Locale: d.DefaultLocale,
ModelVersion: d.LLM.ModelVersion,
})
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Go Seed method lacks concurrency lock for reset

Medium Severity

The Go SemanticCacheDemo.Seed method has no synchronization, unlike the .NET port which explicitly wraps the Clear/Seed sequence in a lock (_seedLock) with the comment: "Two clients hitting /reset back-to-back would otherwise race on the drop/create/seed sequence and leave the index in an inconsistent state." Since Go's net/http handles each request in its own goroutine, concurrent POST /reset requests will race on Clear then Seed, potentially dropping the index mid-seed or double-seeding.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 0049a89. Configure here.

@jit-ci

jit-ci Bot commented May 22, 2026

Copy link
Copy Markdown

❌ Jit Scanner failed - Our team is investigating

Jit Scanner failed - Our team has been notified and is working to resolve the issue. Please contact support if you have any questions.


💡 Need to bypass this check? Comment @sera bypass to override.

@dwdougherty dwdougherty left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from one minor issue (the fact that I can't remember week over week what P95 means), LGTM.

Comment thread content/develop/use-cases/semantic-cache/_index.md Outdated
Co-authored-by: David Dougherty <david.dougherty@redis.com>
@andy-stark-redis

Copy link
Copy Markdown
Contributor Author

@dwdougherty Thanks for the review! There probably won't be too many more use cases for a while now, but I'll remember the P95 thing going forward.

@andy-stark-redis andy-stark-redis merged commit 7746f86 into main May 28, 2026
4 of 5 checks passed
@andy-stark-redis andy-stark-redis deleted the DOC-6644-sem-cache-use-case branch May 28, 2026 08:43
@jit-ci

jit-ci Bot commented May 28, 2026

Copy link
Copy Markdown

❌ Jit Scanner failed - Our team is investigating

Jit Scanner failed - Our team has been notified and is working to resolve the issue. Please contact support if you have any questions.


💡 Need to bypass this check? Comment @sera bypass to override.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 3 total unresolved issues (including 2 from previous reviews).

Fix All in Cursor

Reviewed by Cursor Bugbot for commit 8e68f82. Configure here.

case "--threshold":
a.Threshold = double.Parse(RequireValue(argv, ++i, flag),
System.Globalization.NumberStyles.Float,
System.Globalization.CultureInfo.InvariantCulture);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CLI --threshold accepts NaN/Infinity, breaking /state endpoint

Low Severity

The --threshold and --llm-latency-ms CLI flags use double.Parse which happily accepts "NaN" and "Infinity". If NaN reaches cache.DistanceThreshold, the /state endpoint assigns it into a JsonObject (["default_threshold"] = cache.DistanceThreshold), and System.Text.Json throws JsonException when serializing NaN (which isn't valid JSON). This makes /state return 500 on every call, breaking the demo UI on page load. The same commit's audit-checklist row 32 explicitly identifies this class of bug and prescribes textual rejection before parsing — but the CLI boundary doesn't follow its own guidance.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 8e68f82. Configure here.

EliShteinman added a commit to EliShteinman/docs that referenced this pull request Jun 2, 2026
DOC-6644 Semantic cache use case example
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clients Client library docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants